#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

bool check(const vector<int>& a, int L, double mid) {
    int n = a.size();
    vector<double> prefix(n + 1, 0.0);
    for (int i = 0; i < n; ++i) {
        prefix[i + 1] = prefix[i] + (a[i] - mid);
    }
    double min_prefix = prefix[0];
    for (int j = L; j <= n; ++j) {
        if (prefix[j] - min_prefix >= 0) {
            return true;
        }
        min_prefix = min(min_prefix, prefix[j - L + 1]);
    }
    return false;
}

void solve() {
    int n, L;
    cin >> n >> L;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    double left = -1e4, right = 1e4;
    for (int iter = 0; iter < 100; ++iter) {
        double mid = (left + right) / 2;
        if (check(a, L, mid)) {
            left = mid;
        } else {
            right = mid;
        }
    }
    cout << fixed << setprecision(5) << left << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}